﻿using System.Web.Mvc;
using Snowboard.Web.Models.Board;

namespace Snowboard.Web.Controllers
{
    
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "Welcome to ASP.NET MVC!";

            //var cards = DataService.Cards.FindAllCards();

            return View();
        }

        public ActionResult GetStickerDetails(string stickerId)
        {
            var model = new StickerDetailsModel();
            return PartialView("StickerDetails", model);
        }

        public ActionResult About()
        {
            return View();
        }

        // Ajax way to handle hub requests
        //[HttpPost]
        //public JsonResult MoveSticker(string stickerId, int newX, int newY)
        //{
        //    try
        //    {
        //        Task.Factory.StartNew(
        //            () =>
        //            {
        //                var clients = Hub.GetClients<SnowBoardHub>();
        //                clients.MoveSticker(stickerId, newX, newY);
        //            });

        //        return Json(new { Result = "OK" });
        //    }
        //    catch (Exception ex)
        //    {
        //        return Json(new { Result = "ERROR", Message = ex.Message });
        //    }
        //}
    }
}
